package com.hook3.pianke.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.hook3.pianke.R;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 * 设置里的关于片刻
 * Created by chai on 2015/12/11.
 */
public class AboutPianKe extends Activity {
    private ImageView iv_back_title;
    private TextView title_name;

    private RelativeLayout about_explain_layout;
    private RelativeLayout about_use_explain;
    private RelativeLayout about_contact_layout;
    private RelativeLayout about_update_layout;
    private WebView webView;
    private Intent intent;
    private InputStream am = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.about_pianke);
        iv_back_title = (ImageView) findViewById(R.id.iv_back_title);
        title_name = (TextView) findViewById(R.id.title_name);
        about_explain_layout = (RelativeLayout) findViewById(R.id.about_explain_layout);
        about_use_explain = (RelativeLayout) findViewById(R.id.about_use_explain);
        about_contact_layout = (RelativeLayout) findViewById(R.id.about_contact_layout);
        about_update_layout = (RelativeLayout) findViewById(R.id.about_update_layout);

        iv_back_title.setOnClickListener(new MyAboutPianKeClickListener());
        about_explain_layout.setOnClickListener(new MyAboutPianKeClickListener());
        about_use_explain.setOnClickListener(new MyAboutPianKeClickListener());
        about_contact_layout.setOnClickListener(new MyAboutPianKeClickListener());
        about_update_layout.setOnClickListener(new MyAboutPianKeClickListener());
        title_name.setText("关于片刻");
    }

    private String getJs()
            throws IOException {
        StringBuilder localStringBuilder = new StringBuilder();
        BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(getAssets().open("article.js")));
        for (; ; ) {
            String str = localBufferedReader.readLine();
            if (str == null) {
                break;
            }
            localStringBuilder.append(str);
        }
        localBufferedReader.close();
        return localStringBuilder.toString();
    }

    private String getCss() throws IOException {
        StringBuilder localStringBuilder = new StringBuilder();
        BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(getAssets().open("style.css")));
        for (; ; ) {
            String str = localBufferedReader.readLine();
            if (str == null) {
                break;
            }
            localStringBuilder.append(str);
        }
        localBufferedReader.close();
        return localStringBuilder.toString() + "";
    }

    private String getHtml(String name) throws IOException {
        StringBuilder localStringBuilder = new StringBuilder();
        BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(getAssets().open(name)));
        for (; ; ) {
            String str = localBufferedReader.readLine();
            if (str == null) {
                break;
            }
            localStringBuilder.append(str);
        }
        localBufferedReader.close();
        return localStringBuilder.toString() + "";
    }

    private class MyAboutPianKeClickListener implements View.OnClickListener {
        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.iv_back_title:
                    finish();
                    break;
                case R.id.about_explain_layout:
                    intent = new Intent(AboutPianKe.this,PianKeInclude.class);
                    startActivity(intent);


                    break;
                case R.id.about_use_explain:

                    break;
                case R.id.about_contact_layout:
                    intent = new Intent(AboutPianKe.this,ContactMe.class);
                   startActivity(intent);

                    break;
                case R.id.about_update_layout:

                    break;
            }
        }
    }
}
